]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/brightness: Improve proxy error handling
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 30 Jul 2022 11:07:31 +0000 (13:07 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 1 Aug 2022 12:33:36 +0000 (12:33 +0000)
On error, we currently print a warning and bail out early. That
means we don't hide the slider, despite it being non-functional
without the proxy.

Fix this by making sure _sync() is called in any case. While at
it, use an appropriate log level for the warning message.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>

js/ui/status/brightness.js

index 61258bd59e31352662d2cd0d4388f049c3325e37..5a46c36ff05eeb4b7be3a3609a7629afe938c74c 100644 (file)
@@ -20,15 +20,13 @@ class Indicator extends PanelMenu.SystemIndicator {
     _init() {
         super._init();
         this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
-                                          (proxy, error) => {
-                                              if (error) {
-                                                  log(error.message);
-                                                  return;
-                                              }
-
-                                              this._proxy.connect('g-properties-changed', this._sync.bind(this));
-                                              this._sync();
-                                          });
+            (proxy, error) => {
+                if (error)
+                    console.error(error.message);
+                else
+                    this._proxy.connect('g-properties-changed', () => this._sync());
+                this._sync();
+            });
 
         this._item = new PopupMenu.PopupBaseMenuItem({ activate: false });
         this.menu.addMenuItem(this._item);